package 随机加法器;

import java.awt.*;
import java.util.Random;
import java.util.Scanner;

/**
 * 随机10道题做加法运算
 * 统计正取题号和错误题号
 *
 */
public class 加法器 {
    public static void main(String[] args) {
      String zgengque="";
        String cuowu="";
        Scanner asd=new Scanner(System.in);
        for (int i = 1; i <=10; i++) {
            int a=(int)(Math.random()*10);
            int b=(int)(Math.random()*10);
            System.out.println(i+"题"+a+"+"+b+"=");
            int as=a+b;
            System.out.println("请输入答案:"+as);
            int s=asd.nextInt();
            if (s==as){
                System.out.println("回答正确");
                zgengque=zgengque+i+"题";
            }else if (s!=as){
                System.out.println("回答错误");
                cuowu=cuowu+i+"题";
                continue;
            }

        }
        System.out.println("答对了"+zgengque);
        System.out.println("答错了"+cuowu);



    }
}
